package hczc.longcai.com.hccrowdfunding.home.fourth_mine.fragments;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.Spinner;

import hczc.longcai.com.hccrowdfunding.R;
import hczc.longcai.com.hccrowdfunding.application.BaseApplication;
import hczc.longcai.com.hccrowdfunding.home.fourth_mine.adapters.SponserSpinnerAdapter;

/**
 * A simple {@link Fragment} subclass.
 */
public class SponserFragment extends Fragment {

    /**
     * 众筹总额
     */
    private EditText zcze;
    /**
     * 年利率
     */
    private EditText nll;
    /**
     * 所属分类
     */
    private Spinner ssfl;
    private String[] classify;
    private SponserSpinnerAdapter adapter;

    public SponserFragment() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_sponser, container, false);
        BaseApplication.scaleScreenHelper.loadView(((ViewGroup) view));
        initDatas();


        initViews(view);

        return view;
    }

    private void initDatas() {
        classify = getResources().getStringArray(R.array.classify);
    }

    private void initViews(View view) {

        zcze = ((EditText) view.findViewById(R.id.sponser_zcze));
        nll = ((EditText) view.findViewById(R.id.sponser_nll));
        ssfl = ((Spinner) view.findViewById(R.id.sponser_ssfl));
        initAdapter();
        ssfl.setAdapter(adapter);

    }

    private void initAdapter() {
        adapter = new SponserSpinnerAdapter(getActivity(),classify);
    }


}
